import java.util.Objects;

public class HashBacket2<K,V> {
    static class Node<K,V>{
        public K key;
        public V val;
        Node<K,V> next;
        public Node(K key, V val) {
            this.key = key;
            this.val = val;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Node<?, ?> node = (Node<?, ?>) o;
            return Objects.equals(key, node.key) && Objects.equals(val, node.val) && Objects.equals(next, node.next);
        }

        @Override
        public int hashCode() {
            return Objects.hash(key, val, next);
        }
    }
    Node<K,V>[] array;
    int uesdSize;

    public HashBacket2() {
        this.array = (Node<K, V>[])new Node[10];
        this.uesdSize = 0;
    }

    public V get(K key){
        int tmp = key.hashCode();
        int index = tmp % array.length;
        Node<K,V> cur = array[index];
        while(cur != null){
            if(cur.key == key){
                return cur.val;
            }
            cur = cur.next;
        }
        return null;
    }
}
